import request from "../utils/http.ts";
import type {UserLoginInfo, UserLoginRequest, UserLoginToken} from "../type/user";

export function loginAPI(loginForm: UserLoginRequest) {
    return request<UserLoginToken>({
        url: '/auth/login',
        method: 'post',
        data: loginForm
    })
}

/**
 * 注册
 * */
export function registerAPI(registerForm:FormData) {
    return request<Boolean>({
        url: '/auth/register',
        method: 'post',
        data: registerForm
    })
}

export function getUser() {
    return request<UserLoginInfo>({
        url: '/auth/getLoginUser',
        method: 'GET',
    })
}
